package anji.plus.system.mark.service.impl;

import anji.plus.system.mark.base.BaseServiceImpl;
import anji.plus.system.mark.domain.TaskList;
import anji.plus.system.mark.domain.TaskNodeList;
import anji.plus.system.mark.dto.TaskListDto;
import anji.plus.system.mark.mapper.TaskNodeListMapper;
import anji.plus.system.mark.service.ITaskNodeListService;
import anji.plus.system.mark.vo.TaskListNode;
import cn.hutool.core.bean.BeanUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 * 任务节点表 服务实现类
 * </p>
 *
 * @author luwei
 * @since 2023-11-08
 */
@Service
public class TaskNodeListServiceImpl extends BaseServiceImpl<TaskNodeListMapper, TaskNodeList> implements ITaskNodeListService {

    @Resource
    private TaskNodeListMapper taskNodeListMapper;


    @Override
    public TaskListDto queryTaskDetails(long taskId) {
        TaskListDto taskListDto = new TaskListDto();
        TaskList taskList =  taskNodeListMapper.queryTaskDetails2(taskId);
        if(taskList != null && taskList.getId() != null){
            BeanUtil.copyProperties(taskList,taskListDto);
            List<TaskNodeList> lists = taskNodeListMapper.queryTaskDetails3(taskId);
            taskListDto.setNodeList(lists);
        }
        return taskListDto;
    }


    @Override
    public List<TaskNodeList> updateTaskDetails(List<TaskNodeList> taskNodeList) {
        return null;
    }
}
